Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: instrument aiohttp with trace_configs argument #1079

Merged
merged 18 commits into from
Jun 26, 2022

Conversation

nemoshlag
Copy link
Member

Description

Adding trace_configs argument to aiohttp client wrapper enables additional customization. For instance, on_request_chunk_sent event is called after span was created and before request was ended - making it impossible to capture data chunks when using request or response hooks.

Fixes #1073 (issue)

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

The trace_configs feature is already integrated and tested with aiohttp wrapper library (https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py).
An additional test was added to verify new functionality - creating 2 spans with passing trace_configs as an argument to instrument func.

  • Test A -> test_instrument_with_custom_trace_config

Does This PR Require a Core Repo Change?

  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Unit tests have been added

@nemoshlag nemoshlag requested a review from a team May 1, 2022 12:50
@sanketmehta28
Copy link
Member

Please do resolve build errors

@sanketmehta28
Copy link
Member

still 9 checks are failing. @nemoshlag : Can you please look into that

@@ -262,6 +262,7 @@ def _instrument(
url_filter: _UrlFilterT = None,
request_hook: _RequestHookT = None,
response_hook: _ResponseHookT = None,
trace_configs: list = (),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default value here is tuple, not list

@srikanthccv
Copy link
Member

@nemoshlag This is easy fix. Please address the comments and it should be ready to merge.

@srikanthccv srikanthccv merged commit e267ebc into open-telemetry:main Jun 26, 2022
@nemoshlag nemoshlag deleted the feat/aiohttp-trace-configs branch June 26, 2022 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inject trace_configs as an argument to opentelemetry aiohttp_client._instrument instrumentation
4 participants